const fs = require('fs')
const path = require('path')

// 获取db文件夹下的collection文件列表
let filesList = fs.readdirSync(__dirname)

let collections = {}

filesList.forEach((file, index) => {

  let collectionName = file.substr(0, file.length - 3).replace(file[0],file[0].toUpperCase())
  let file_require = require(path.join(__dirname, file))

  if(collectionName !== 'createConn'||'index') {
    collections[collectionName] = file_require
  }
})

module.exports = () => collections